<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('成绩输入列表')" />
</head>
<body class="gray-bg">
     <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="formId">
                    <div class="select-list">
                        <ul>
                            <li>
                                <label>学号：</label>
                                <input type="text" name="stuSno"/>
                            </li>
                            <li>
                                <label>姓名：</label>
                                <input type="text" name="stuName"/>
                            </li>

                            <li>
                                <label>原班级：</label>
                                <select name="stuClass" th:with="type=${@dict.getType('sys_stu_class')}">
                                    <option value="">所有</option>
                                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                                </select>
                            </li>
                            <li>
                                面试分组：
                                <select name="groupId" th:with="type=${@dict.getType('sys_interv_group')}">
                                    <option value="">所有</option>
                                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                                </select>
                            </li>
                            <li>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>

            <div class="btn-group-sm" id="toolbar" role="group">
                <a class="btn btn-success" onclick="result()" >
                    <i class="fa fa-plus"></i> 最终成绩生成
                </a>
                <a class="btn btn-primary single disabled" onclick="$.operate.edit()" >
                    <i class="fa fa-edit"></i> 修改
                </a>
                <!--<a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()">-->
                    <!--<i class="fa fa-remove"></i> 删除-->
                <!--</a>-->
                <a class="btn btn-warning" onclick="$.table.exportExcel()" >
                    <i class="fa fa-download"></i> 导出
                </a>
            </div>
            <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-table"></table>
            </div>
        </div>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var group=[[${group}]];
        var prefix = ctx + "system/test";

        function result() {
            if($.common.equals("0", group.toString())){
                $.modal.confirm("确定生成最终的机试面试成绩吗？", function() {
                    $.ajax({
                        type: "post",
                        url: prefix+"/result",
                        beforeSend: function () {
                            $.modal.loading("正在处理中，请稍后...");
                        },
                        success: function () {
                            window.location.reload();
                        }
                    });
                });
            }else{

            }

        }
        $(function() {
            var options = {
                url: prefix + "/machineList",
                createUrl: prefix + "/add",
                updateUrl: prefix + "/machineEdit/{id}",
                removeUrl: prefix + "/remove",
                exportUrl: prefix + "/export",
                showColumns: false,
                modalName: "成绩输入",
                columns: [{
                    checkbox: true
                },
                {
                    field: 'stuSno',
                    title: '学号',
                    visible: true
                },
                {
                    field: 'stuName',
                    title: '姓名'
                },
                {
                    field: 'stuPhone',
                    title: '电话'
                },
                {
                    field: 'stuClass',
                    title: '原班级'
                },
                {
                    field: 'stuC',
                    title: 'C语言'
                },
                {
                    field: 'stuEnglish',
                    title: '大学英语'
                },
                {
                    field: 'stuMath',
                    title: '高等数学'
                },
                {
                    field: 'computerTest',
                    title: '最终机试成绩'
                },
                {
                    field: 'meetTest',
                    title: '最终面试成绩'
                },
                {
                    field: 'computerTest1',
                    title: '机试第一题'
                },
                {
                    field: 'computerTest2',
                    title: '机试第二题'
                },
                {
                    field: 'computerTest3',
                    title: '机试第三题'
                },
                {
                    field: 'computerTest4',
                    title: '机试第四题'
                },
                {
                    field: 'computerTest5',
                    title: '机试第五题'
                },
                {
                    field: 'meetTest1',
                    title: '面试成绩一'
                },
                {
                    field: 'meetTest2',
                    title: '面试成绩二'
                },
                {
                    field: 'meetTest3',
                    title: '面试成绩三'
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function(value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-success btn-xs " href="javascript:void(0)" onclick="$.operate.edit(\'' + row.stuSno + '\')"><i class="fa fa-edit"></i>编辑</a> ');
                        // actions.push('<a class="btn btn-danger btn-xs " href="javascript:void(0)" onclick="$.operate.remove(\'' + row.stuSno + '\')"><i class="fa fa-remove"></i>删除</a>');
                        return actions.join('');
                    }
                }],
                onLoadSuccess: function(){
                    if($.common.equals("-1", group.toString())){
                        $.table.hideColumn('meetTest1');
                        $.table.hideColumn('meetTest2');
                        $.table.hideColumn('meetTest3');
                        $.table.hideColumn('computerTest1');
                        $.table.hideColumn('computerTest2');
                        $.table.hideColumn('computerTest3');
                        $.table.hideColumn('computerTest4');
                        $.table.hideColumn('computerTest5');
                    }
                    if($.common.equals("1", group.toString())){
                        $.table.hideColumn('meetTest');
                        $.table.hideColumn('computerTest');
                        $.table.hideColumn('meetTest1');
                        $.table.hideColumn('meetTest2');
                        $.table.hideColumn('meetTest3');
                        $.table.hideColumn('computerTest2');
                        $.table.hideColumn('computerTest3');
                        $.table.hideColumn('computerTest4');
                        $.table.hideColumn('computerTest5');
                    }
                    if($.common.equals("2", group.toString())){
                        $.table.hideColumn('meetTest');
                        $.table.hideColumn('computerTest');
                        $.table.hideColumn('meetTest1');
                        $.table.hideColumn('meetTest2');
                        $.table.hideColumn('meetTest3');
                        $.table.hideColumn('computerTest1');
                        $.table.hideColumn('computerTest3');
                        $.table.hideColumn('computerTest4');
                        $.table.hideColumn('computerTest5');
                    }
                    if($.common.equals("3", group.toString())){
                        $.table.hideColumn('meetTest');
                        $.table.hideColumn('computerTest');
                        $.table.hideColumn('meetTest1');
                        $.table.hideColumn('meetTest2');
                        $.table.hideColumn('meetTest3');
                        $.table.hideColumn('computerTest1');
                        $.table.hideColumn('computerTest2');
                        $.table.hideColumn('computerTest4');
                        $.table.hideColumn('computerTest5');
                    }
                    if($.common.equals("4", group.toString())){
                        $.table.hideColumn('meetTest');
                        $.table.hideColumn('computerTest');
                        $.table.hideColumn('meetTest1');
                        $.table.hideColumn('meetTest2');
                        $.table.hideColumn('meetTest3');
                        $.table.hideColumn('computerTest1');
                        $.table.hideColumn('computerTest2');
                        $.table.hideColumn('computerTest3');
                        $.table.hideColumn('computerTest5');
                    }
                    if($.common.equals("5", group.toString())){
                        $.table.hideColumn('meetTest');
                        $.table.hideColumn('computerTest');
                        $.table.hideColumn('meetTest1');
                        $.table.hideColumn('meetTest2');
                        $.table.hideColumn('meetTest3');
                        $.table.hideColumn('computerTest1');
                        $.table.hideColumn('computerTest2');
                        $.table.hideColumn('computerTest3');
                        $.table.hideColumn('computerTest4');
                    }
                }

            };

            $.table.init(options);
        });
    </script>
</body>
</html>
